package com.zscat.mallplus.config;

import com.zscat.mallplus.dms.service.impl.MeituanTokenTask;
import org.quartz.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

//抖音token定时更新程序
//这个类主要是做配置类去配置JobDetail，Trigger即配置工作明细，和触发器，
//定时任务配置类
@Configuration
public class MeituanQuartzConfig {
    @Bean
    public JobDetail meituanJobDetail() {
        return JobBuilder.newJob(MeituanTokenTask.class).storeDurably().build();
    }

    @Bean
    public Trigger triggerMeituan() {
        ScheduleBuilder schdule = CronScheduleBuilder.cronSchedule("0 0 0 5,25 * ?");
        return TriggerBuilder.newTrigger().forJob(meituanJobDetail()).withSchedule(schdule).build();
    }
}

